using AlipayClass;
using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
public class User_Alipay_alipayto : Member, IRequiresSessionState
{
	public static string OrderFormNum = "";
	public DataTable DTOrder;
	protected static DataRow Payconfig = new Config().config;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		User_Alipay_alipayto.OrderFormNum = Fetch.Get("OrderFormNum");
		if (User_Alipay_alipayto.OrderFormNum == string.Empty)
		{
			this.WriteErrMsg("", Language.Get("Common/LostParam", "OrderFormNum"), "");
		}
		Shop_Order shop_Order = new Shop_Order(this.conn);
		this.DTOrder = shop_Order.GetAllByOrderFormNum(User_Alipay_alipayto.OrderFormNum);
		if (this.DTOrder.Rows.Count <= 0)
		{
			this.WriteErrMsg("", Language.Get("Common/NotData"), "");
		}
		AlipayConfig alipayConfig = new AlipayConfig();
		string partner = this.DTOrder.Rows[0]["BussinessCount"].ToString();
		string key = this.DTOrder.Rows[0]["BussinesMD5Key"].ToString();
		string seller_email = this.DTOrder.Rows[0]["PayAccount"].ToString();
		string input_charset = alipayConfig.Input_charset;
		string arg_168_0 = User_Alipay_alipayto.Payconfig["SiteUrl"].ToString().Contains("http://") ? User_Alipay_alipayto.Payconfig["SiteUrl"].ToString() : ("http://" + User_Alipay_alipayto.Payconfig["SiteUrl"].ToString());
		string notify_url = "http://www.lehui365.net/PayReturn/User/Alipay/notify_url.aspx";
		string return_url = "http://www.lehui365.net/PayReturn/User/Alipay/return_url.aspx";
		string show_url = alipayConfig.Show_url;
		string sign_type = alipayConfig.Sign_type;
		string antiphishing = alipayConfig.Antiphishing;
		string out_trade_no = this.DTOrder.Rows[0]["OrderFormNum"].ToString();
		string subject = "在线充值";
		string body = "在线充值";
		string total_fee = Fetch.Get("TotalPrice");
		string defaultbank = "";
		string text = "Alipay";
		string paymethod;
		if (text == "Alipay")
		{
			paymethod = "directPay";
		}
		else
		{
			paymethod = "bankPay";
			defaultbank = text;
		}
		string encrypt_key = "";
		string exter_invoke_ip = "";
		if (antiphishing == "1")
		{
			encrypt_key = AlipayFunction.Query_timestamp(partner);
			exter_invoke_ip = "";
		}
		string extra_common_param = "";
		string buyer_email = "";
		string royalty_type = "";
		string royalty_parameters = "";
		string it_b_pay = "";
		AlipayService alipayService = new AlipayService(partner, seller_email, return_url, notify_url, show_url, out_trade_no, subject, body, total_fee, paymethod, defaultbank, encrypt_key, exter_invoke_ip, extra_common_param, buyer_email, royalty_type, royalty_parameters, it_b_pay, key, input_charset, sign_type);
		string s = alipayService.Build_Form();
		base.Response.Write(s);
	}
}
